class Solution:
    def fib(self, n: int) -> int:
        if n<=1:return n

        f0 = 0
        f1 = 1
        s = 0
        for i in range(2, n+1):
            s = (f0+f1)%1000000007;
            f0 = f1 
            f1 = s
        
        return s